int*p; ----- p = malloc(500);
int*p; ----- p=calloc(4,100);
int *p; p = malloc(200); p = realloc( p , 500);
int*p; p = malloc(500); free( p );
#include<stdio.h> main() { int i,n,s,*p ; printf("how many nos "); scanf("%d",&n); p=malloc(n*4); printf("enter %d nos.",n); for(i=0;i<n;i++) scanf("%d",p+i); s=0; for(i=0;i<n;i++) s=s+*(p+i); printf("sum is %d",s); free(p); }
How many nos 5 5 7 6 1 2 Sum is 21